package la.iok.hzsvn.lewin.movie.shopmovie.cfg;

import la.iok.hzsvn.redis.config.RedisKeyProperties;
import org.springframework.stereotype.Service;

@Service
public class RedisKey {
    private final String keyPrefix;
    public RedisKey(RedisKeyProperties keyProperties){
        //sm代表shop-movie
        keyPrefix = keyProperties.getKeyPrefix() + ":sm:";
    }

    /**
     * 优惠券uuid对应的优惠券id的key
     * @param uuid 优惠券uuid,返回给前端生成二维码,用户扫描二维码拿到uuid就可以获取绑定的优惠券
     * @return the key
     */
    public String couponQrKey(String uuid){
        return keyPrefix + "cp:qr:" + uuid;
    }

    public String redisIncrementIdKey(int timestamp) {
        return keyPrefix + "inc:" + timestamp;
    }
}
